package org.输入输出练习;

import java.util.Scanner;

/**
 * @Auther: qingle
 * @Date: 2024/8/19-3:06
 * @Description: 给定一个长度为n 的字符串s ，请你将其倒置，然后输出
 * @version: 1.0
 */
public class PIO11_多组_字符串_T组形式 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		while(t-- > 0) {
			int n = scanner.nextInt();
			String s = scanner.next();
			String substring = s.substring(0, n);
			System.out.println(new StringBuilder(substring).reverse());
		}
	}
}
